<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    {include file="public/title" /}
    <meta name="keywords" content="HTML5 Bootstrap 3 Admin Template UI Theme">
    <meta name="description" content="Fusion - A Responsive HTML5 Admin UI Template Theme">
    <meta name="author" content="AdminDesigns">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    {include file="public/css" /}
    <style>
        .table a { color: blue;}
        dl, li { list-style:none;}
        .panel-body dt, .panel-body dd { float: left;}
        .clear {clear: both;}
        .panel-body dt { width: 7%;}
        .panel-body dd { width: 90%;}
        .panel-body dd li { float: left; min-width: 6%; padding: 0 10px;}
        .form-horizontal { padding-left: 30px;}
    </style>
</head>
<body class="dashboard-page">

{include file="public/header" /}

<!-- Start: Main -->
<div id="main">

    <!-- Start: Sidebar -->
    <aside id="sidebar_left">
        <div class="sidebar-menu">
            <!--菜单-->
            {include file="public/menu" /}
        </div>
    </aside>

    <!-- Start: Content -->
    <section id="content_wrapper">
        <div id="topbar">
            <!--所在-->
            {include file="public/topbar" /}
        </div>
        <div id="content">
            <div class="row">
                <div class="col-md-12">
                    <div class="panel">
                        <div class="panel-body">
                            <div class=" paging_bs_normal">
                                <ul class="pagination pagination-sm">
                                    <li {if condition="$type eq 'today'"}class="active"{/if}>
                                        <a href="/index/statistics?type=today">今天</a>
                                    </li>
                                    <li {if condition="$type eq 'yesterday'"}class="active"{/if}>
                                        <a href="/index/statistics?type=yesterday">昨天</a>
                                    </li>
                                    <li {if condition="$type eq 'sevenday'"}class="active"{/if}>
                                        <a href="/index/statistics?type=sevenday">近7天</a>
                                    </li>
                                    <li {if condition="$type eq 'thirtyday'"}class="active"{/if}>
                                        <a href="/index/statistics?type=thirtyday">近30天</a>
                                    </li>
                                    <li id="custom" {if condition="$type eq 'custom'"}class="active"{/if}>
                                        <a href="javascript:;">自定义时间</a>
                                    </li>
                                </ul>
                                <div class="form-group" id="custom-html" {if condition="$type neq 'custom'"}style="display: none;"{/if}>
                                    <form action="/index/statistics" method="get">
                                    <div class="col-lg-5" style="line-height: 30px;">
                                        <input class="form-control input-sm" id="starttime" name="starttime" type="text" placeholder="开始时间" value="{$starttime}" style="width: 20%; float: left; " />
                                        <input class="form-control input-sm" id="endtime" name="endtime" type="text" placeholder="结束时间" value="{$endtime}" style="width: 20%; float: left; margin: 0 20px;" />
                                        <input type="text" name="type" value="custom" style="display: none;" />
                                        <button type="submit" class="btn btn-alert">查询数据</button>
                                    </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-md-12">
                    <div class="panel">
                        <div class="panel-body">
                            <div class="table-responsive">
                                <table class="table table-bordered">
                                    <thead>
                                    <tr>
                                        <th>总收入</th>
                                        <th>总访问量</th>
                                        <th>平均转化率（元/次）</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr>
                                        <td>{$earnings_data}</td>
                                        <td>{$visits_data}</td>
                                        <td>
                                            {php}
                                                if ($earnings_data > 0 && $visits_data > 0)
                                                    echo number_format($earnings_data/$visits_data*100, 2);
                                                else
                                                    echo 0;
                                            {/php}
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="clearfix"></div>
            </div>
        </div>
    </section>

</div>
<!-- End #Main -->
{include file="public/js" /}
<script type="text/javascript">
    $("#starttime,#endtime").datepicker();
    $('#custom').click(function(){
        $('.pagination li').removeClass('active');
        $(this).addClass('active');
        $('#custom-html').show();
    });
</script>

</body>
</html>
